<include file="public@header" />
<link rel="stylesheet" type="text/css" href="__TMPL__/public/assets/css/index.css" />
</head>

<body>
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li class="active"><a href="{:url('team/team_list')}">咨询列表</a></li>
        </ul>
        <form class="well form-inline margin-top-20" method="get" action="{:url('lands/index_list')}">
            用户名:
            <input type="text" class="form-control" name="nick" style="width: 120px;"
                value="{:input('request.nick/s','')}" placeholder="请输入用户名">
            手机号:
            <input type="text" class="form-control" name="phone" style="width: 180px;"
                value="{:input('request.phone/s','')}" placeholder="请输入手机号">
            状态:
            <select class="form-control" name="status" style="width: 150px;">
                <option value='' selected>全部</option>
                <option value='1' <if condition="$status eq 1">selected</if>>待回复</option>
                <option value='2' <if condition="$status eq 2">selected</if>>已回复</option>
            </select>
            时间:
            <input type="text" class="form-control js-bootstrap-datetime" name="create_time"
                value="{$create_time|default=''}" style="width: 150px;" autocomplete="off"> -
            <input type="text" class="form-control js-bootstrap-datetime" name="end_time" value="{$end_time|default=''}"
                style="width: 150px;" autocomplete="off">
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn btn-danger" href="{:url('lands/index_list')}">清空</a>

        </form>
        <table class="table table-hover table-bordered">
            <thead>
                <tr>
                    <th width="30">ID</th>
                    <th width="60">姓名</th>
                    <th>手机号</th>
                    <th width="100">咨询时间</th>
                    <th>咨询内容</th>
                    <th width="60">状态</th>
                    <th>回复</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <foreach name="list" item="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.nick}</td>
                        <td>{$vo.phone}</td>
                        <td>{$vo.date}</td>
                        <td>{$vo.content}</td>
                        <td>
                            <if condition="$vo.status eq 1">待处理<else>已处理</if>
                        </td>
                        <td>{$vo.remarks}</td>
                        <td class="button_box">
                            <span class="btn btn-xs btn-primary" onclick="show_report({$vo.id},'{$vo.remarks}')">回复</span>
                        </td>
                    </tr>
                </foreach>
            </tbody>
        </table>
        <div class="pagination">{$page}</div>
        <!-- 弹窗 -->
        <div class="tc_bg">
            <div class="tc_box report_box" style="width: 400px">
                <p class="tc_txt">添加备注：</p>
                <div class="tc_txt_box">
                    <textarea rows="6" name="report_proposal"></textarea>
                </div>
                <div class="tc_btn_box">
                    <button class="btn btn-success" onclick="report()">确认</button>
                    <button class="btn btn-warning" onclick="closeshow()">取消</button>
                </div>
            </div>
        </div>
    </div>
    <script src="__STATIC__/js/admin.js"></script>
    <script type="text/javascript" src="__TMPL__/public/assets/js/layer/layer.js"></script>
    <script>
        var urls = "http://" + window.location.host;
        function show_report(uid,val) {
            show('.report_box', uid, val);
        }
        function show(name, uid,val) {
            var userid = uid || "";
            var content = val|| "";
            $(name).find("textarea[name='report_proposal']").html(content);
            $(".tc_bg").css("display", "block");
            $("input[type = 'hidden']", ".tc_box").remove();
            $(name).append('<input type="hidden" value="' + userid + '">');
            $(name).css("display", "block");
        }

        function closeshow() {
            $(".tc_bg").css("display", "none");
            $(".tc_box").css("display", "none");
        }

        function report() {
            $("button").attr("disabled", true);
            var uid = $("input[type = 'hidden']", ".tc_box").val();
            var val = $("textarea[name='report_proposal']").val();
            if (val != "") {
                $.ajax({
                    type: "post",
                    url: urls + "/admin/lands/lands_remarks",
                    data: {
                        id: uid,
                        remarks: val
                    },
                    dataType: "json",
                    success: function (res) {
                        layer.msg("操作成功！", {
                            time: 1600
                        });
                        $("button").attr("disabled", false);
                        setTimeout(function () {
                            location.reload();
                        }, 1800);
                    }
                });
            } else {
                $("button").attr("disabled", false);
                layer.msg("请输入备注！", {
                    time: 1600
                });
            }
        }
        
        function outExcel() {
            var name = $("input[name='nick']").val() || "";
            var phone = $("input[name='phone']").val() || "";
            var status = $("select[name='status']").val() || "";
            var create_time = $("input[name='create_time']").val() || "";
            var end_time = $("input[name='end_time']").val() || "";
            $.ajax({
                type: "post",
                url: "url",
                data: {
                    
                },
                dataType: "json",
                success: function (response) {
                    
                }
            });

        }
    </script>
</body>

</html>